package com.codebattery.config;

import io.minio.MinioClient;
import io.minio.errors.InvalidEndpointException;
import io.minio.errors.InvalidPortException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MinioAutoConfiguration {

   @Value("${minio.url}")
   private String url;
   @Value("${minio.accessKey}")
   private String accessKey;
   @Value("${minio.secretKey}")
   private String secretKey;
   @Value("${minio.bucketName}")
   private String bucketName;

   @Bean
   public MinioClient  minioClient() throws InvalidPortException, InvalidEndpointException {
      MinioClient  client =new MinioClient(url, accessKey, secretKey);
      return  client;
   }

}